package auction.chapter12;

import org.hibernate.event.LoadEvent;
import org.hibernate.event.LoadEventListener;
import org.hibernate.event.def.DefaultLoadEventListener;

/**
 * 
 * @author wei
 *
 */
public class MyLoadEventListener extends DefaultLoadEventListener {
	public void onLoad(LoadEvent event,LoadEventListener.LoadType loadType){
		out("=====before start");
		out("getInstanceToLoad="+event.getInstanceToLoad());
		out("getResult="+event.getResult());
		out("getEntityClassName="+event.getEntityClassName());
		out("getEntityId="+event.getEntityId());
		out("getLockMode="+event.getLockMode());
		out(loadType+" "+loadType.getName());
		out("=====before end");
		super.onLoad(event, loadType);
		
		out("=====after start");
		out("getInstanceToLoad="+event.getInstanceToLoad());
		out("getResult="+event.getResult());
		out("getEntityClassName="+event.getEntityClassName());
		out("getEntityId="+event.getEntityId());
		out("getLockMode="+event.getLockMode());
		out(loadType+" "+loadType.getName());
		out("=====after end");
	}
	
	static void out(Object obj)
	{
		System.out.println("--->" + obj);
	}
}
